package stud.aistar.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import stud.aistar.entity.Treatment;
import stud.aistar.mapper.DoctorPatientVoMapper;
import stud.aistar.service.IDoctorPatientVoService;
import stud.aistar.vo.CountTimeVo;
import stud.aistar.vo.DoctorPatientVo;

import java.util.List;
import java.util.Map;

/**
 * *
 *
 * @ClassName :wangyu
 * @Description
 * @Author
 * @Date2019/10/2 13:08
 * @Version V1.0
 */
@Service
@Transactional
public class DoctorPatientServiceImpl implements IDoctorPatientVoService {

    @Autowired
    private DoctorPatientVoMapper mapper;


    @Override
    public PageInfo<DoctorPatientVo> findPage(Integer docId, Map<String, String> paramMap) {

        Integer pageNum = Integer.valueOf(paramMap.get("page"));

        Integer pageSize = Integer.valueOf(paramMap.get("limit"));

        PageHelper.startPage(pageNum,pageSize);

        List<DoctorPatientVo> list = mapper.findAll(docId);

        PageInfo<DoctorPatientVo> pageInfo = new PageInfo<>(list);

        return pageInfo;
    }

    @Override
    public List<DoctorPatientVo> findAll(Integer dId) {

        List<DoctorPatientVo> list = mapper.findAll(1);

        return list;

    }

    @Override
    public int findCount() {

        Integer count = mapper.findCount();
        return count;
    }

    @Override
    public List<DoctorPatientVo> findById(Integer id) {

        List<DoctorPatientVo> list = mapper.findById(id);

        return list;
    }

    @Override
    public List<CountTimeVo> findCountAndTime(Integer docId) {

        List<CountTimeVo> list = mapper.findCountAndTime(docId);

        return list;
    }
}
